package servlet.admin.operator;

import entity.Operator;
import service.OperatorService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet( name =  "AdminOperatorUpdateInfoServlet")
public class AdminOperatorUpdateInfoServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       String operatorID=request.getParameter("operatorID");
        OperatorService service=new OperatorService();
        Operator operator=service.getOperatorById(operatorID);

        request.setAttribute("operator",operator);
        request.getServletContext().getRequestDispatcher("/admin/operatorUpdate.jsp").forward(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
